﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Data.SqlClient;
using yunbo.Model.BIP;
using yunbo.Repositorys.BIPRepositorys;
using yunbo.Repositorys.FPMRepositorys;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace yunbo.Controllers.BIPControllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class MBD_GXController : ControllerBase
    {
        MBD_GXRepository MBD_GXRepository = new MBD_GXRepository();

        /// <summary>
        /// 查询工序
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetMbd_GX")]
        public IActionResult GetMbd_GX()
        {
            var quans = MBD_GXRepository.GetMbd_GX();
            return Ok(quans);
        }
        [HttpPut("UpdateStatus")]
        public IActionResult UpdateStatus(string gx_code, int gx_state, int update_by)
        {
            int quans = MBD_GXRepository.UpdateStatus(gx_code, gx_state, update_by);
            return Ok(quans);
        }
        [HttpPut("UpdateDelete")]
        public IActionResult UpdateDelete(string gx_code, int isdelete, int update_by)
        {
            int quans = MBD_GXRepository.UpdateDelete(gx_code, isdelete, update_by);
            return Ok(quans);
        }   

        [HttpPost("AddMbd_gx")]
        public IActionResult AddMbd_gx(Mbd_GX mbd_GX)
        {
            var quans = MBD_GXRepository.AddMbd_gx(mbd_GX);
            return Ok(quans);
        }
        [HttpPut("UpdateMbd_GX")]
        public IActionResult UpdateMbd_GX(Mbd_GXs mbd_GX)
        {
            var quans = MBD_GXRepository.UpdateMbd_GX(mbd_GX);
            return Ok(quans);
        }
        /// <summary>
        /// 查询工序
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetMbd_GXCode")]
        public IActionResult GetMbd_GXCode(string code)
        {
            CXMdb_GX gX_Gies = MBD_GXRepository.GetMbd_GXCode(code);
            return Ok(gX_Gies);
        }
    }
}
